package c.a.a.z.b;

import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.RectF;
import c.a.a.b0.e;
import c.a.a.b0.k.j;
import c.a.a.b0.k.q;
import c.a.a.e0.f;
import c.a.a.l;
import c.a.a.z.c.a;
import c.a.a.z.c.a.b;
import c.a.a.z.c.c;
import java.util.List;

/* compiled from: RectangleContent */
public class o implements b, k, m {
    public final Path a = new Path();
    public final RectF b = new RectF();
    public final String c;
    public final boolean d;
    public final l e;
    public final a<?, PointF> f;
    public final a<?, PointF> g;
    public final a<?, Float> h;
    public b i = new b();
    public boolean j;

    public o(l lVar, c.a.a.b0.l.b bVar, j jVar) {
        this.c = jVar.a;
        this.d = jVar.e;
        this.e = lVar;
        a a = jVar.b.a();
        this.f = a;
        a a2 = jVar.c.a();
        this.g = a2;
        a a3 = jVar.d.a();
        this.h = a3;
        bVar.e(a);
        bVar.e(a2);
        bVar.e(a3);
        a.a.add(this);
        a2.a.add(this);
        a3.a.add(this);
    }

    public String a() {
        return this.c;
    }

    public void c() {
        this.j = false;
        this.e.invalidateSelf();
    }

    public void d(List<c> list, List<c> list2) {
        for (int i = 0; i < list.size(); i++) {
            c cVar = (c) list.get(i);
            if (cVar instanceof s) {
                s sVar = (s) cVar;
                if (sVar.c == q.a.SIMULTANEOUSLY) {
                    this.i.a.add(sVar);
                    sVar.b.add(this);
                }
            }
        }
    }

    public void f(e eVar, int i, List<e> list, e eVar2) {
        f.f(eVar, i, list, eVar2, this);
    }

    public Path h() {
        if (this.j) {
            return this.a;
        }
        this.a.reset();
        if (this.d) {
            this.j = true;
            return this.a;
        }
        float f;
        float f2;
        float f3;
        float f4;
        RectF rectF;
        float f5;
        PointF pointF = (PointF) this.g.e();
        float f6 = pointF.x / 2.0f;
        float f7 = pointF.y / 2.0f;
        a aVar = this.h;
        if (aVar == null) {
            f = 0.0f;
        } else {
            f = ((c) aVar).j();
        }
        float min = Math.min(f6, f7);
        if (f > min) {
            f = min;
        }
        PointF pointF2 = (PointF) this.f.e();
        this.a.moveTo(pointF2.x + f6, (pointF2.y - f7) + f);
        this.a.lineTo(pointF2.x + f6, (pointF2.y + f7) - f);
        int i = (f > 0.0f ? 1 : (f == 0.0f ? 0 : -1));
        if (i > 0) {
            RectF rectF2 = this.b;
            f2 = pointF2.x;
            float f8 = f * 2.0f;
            f3 = (f2 + f6) - f8;
            f4 = pointF2.y;
            rectF2.set(f3, (f4 + f7) - f8, f2 + f6, f4 + f7);
            this.a.arcTo(this.b, 0.0f, 90.0f, false);
        }
        this.a.lineTo((pointF2.x - f6) + f, pointF2.y + f7);
        if (i > 0) {
            rectF = this.b;
            f5 = pointF2.x;
            f2 = f5 - f6;
            f3 = pointF2.y;
            f4 = f * 2.0f;
            rectF.set(f2, (f3 + f7) - f4, (f5 - f6) + f4, f3 + f7);
            this.a.arcTo(this.b, 90.0f, 90.0f, false);
        }
        this.a.lineTo(pointF2.x - f6, (pointF2.y - f7) + f);
        if (i > 0) {
            rectF = this.b;
            f5 = pointF2.x;
            f2 = f5 - f6;
            f3 = pointF2.y;
            f4 = f * 2.0f;
            rectF.set(f2, f3 - f7, (f5 - f6) + f4, (f3 - f7) + f4);
            this.a.arcTo(this.b, 180.0f, 90.0f, false);
        }
        this.a.lineTo((pointF2.x + f6) - f, pointF2.y - f7);
        if (i > 0) {
            rectF = this.b;
            float f9 = pointF2.x;
            f *= 2.0f;
            f5 = (f9 + f6) - f;
            float f10 = pointF2.y;
            rectF.set(f5, f10 - f7, f9 + f6, (f10 - f7) + f);
            this.a.arcTo(this.b, 270.0f, 90.0f, false);
        }
        this.a.close();
        this.i.a(this.a);
        this.j = true;
        return this.a;
    }

    public <T> void i(T t, c.a.a.f0.c<T> cVar) {
        a aVar;
        c.a.a.f0.c cVar2;
        if (t == c.a.a.q.h) {
            aVar = this.g;
            cVar2 = aVar.e;
            aVar.e = cVar;
        } else if (t == c.a.a.q.j) {
            aVar = this.f;
            cVar2 = aVar.e;
            aVar.e = cVar;
        } else if (t == c.a.a.q.i) {
            aVar = this.h;
            cVar2 = aVar.e;
            aVar.e = cVar;
        }
    }
}
